
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>子域名扫描详情</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">

        <fieldset class="table-search-fieldset">
            <legend>搜索信息</legend>
            <div style="margin: 10px 10px 10px 10px">
                <form class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">子域名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="SubDomain" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">IP</label>
                            <div class="layui-input-inline">
                                <input type="text" name="IP" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">地区</label>
                            <div class="layui-input-inline">
                                <input type="text" name="Location" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button type="submit" class="layui-btn layui-btn-primary"  lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
                        </div>
                    </div>
                </form>
            </div>
        </fieldset>

        <script type="text/html" id="toolbarSubDomainDetails">
            <div class="layui-btn-container">
                <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="export"><i class="layui-icon">&#xe67c;</i>导出数据</button>
            </div>
        </script>

        <table class="layui-hide" id="currentTable_subdomainDetails" lay-filter="currentTableFilter"></table>

    </div>

</div>
<script src="/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
    layui.use(['form', 'table'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table;

        var TaskName = localStorage.getItem("task_name");
        if (TaskName === ""){
            var iframeIndex = parent.layer.getFrameIndex(window.name);
            parent.layer.close(iframeIndex);
        }

        table.render({
            elem: '#currentTable_subdomainDetails',
            url: "/api/util/subdomain/show",
            toolbar: '#toolbarSubDomainDetails',
            where:{"taskname": TaskName},
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [
                [{
                    field: 'id',
                    width: 80,
                    title: 'ID',
                    sort: true
                },
                    {
                        field: 'subdomain',
                        width: 200,
                        title: '子域名',
                        sort: true
                    },
                    {
                        field: 'ip',
                        width: 160,
                        title: 'ip'
                    },
                    {
                        field: 'location',
                        width: 260,
                        title: '地区'
                    },
                    {
                        field: 'cdn',
                        title: 'CDN',
                        width: 100,
                        templet:function(d){
                            if (d.cdn){
                                d.cdn = "是";
                            }else{
                                d.cdn = "否";
                            }
                            return d.cdn;
                        },
                    },
                    {
                        field: 'cname',
                        title: 'CNAME',
                        width: 200
                    },
                    {
                        field: 'create_at',
                        title: '时间',
                        minWidth: 500
                    },

                ]
            ],
            limits: [10, 20, 40, 60, 80, 100],
            limit: 20,
            page: true,
            skin: 'line'
        });

        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            var result = JSON.stringify(data.field);
            //执行搜索重载
            table.reload('currentTable_subdomainDetails', {
                page: {
                    curr: 1
                }
                , where: {
                    searchParams: result
                }
            }, 'data');

            return false;
        });

        //头工具栏事件
        table.on('toolbar(currentTableFilter)', function(obj){
            if(obj.event === "export"){
                window.location.href='/api/util/subdomain/export/' + TaskName;
            }
        });

        });
</script>

</body>
</html>
